package com.qcby.demo.proxyaop.controller;

import com.qcby.demo.proxyaop.aop.SelfLog;
import com.qcby.demo.proxyaop.aop.SelfRecords;
import com.qcby.demo.proxyaop.aop.ViewRecords;
import com.qcby.demo.proxyaop.web.Constant;
import com.qcby.demo.proxyaop.web.ResultJson;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;

/**
 * @className: DemoController
 * @description:
 * @author: lxt
 * @create: 2021-05-12 18:10
 **/
@RestController
@RequestMapping("demo0513")
@Slf4j
public class Demo0513Controller {


    @SelfRecords
    @RequestMapping("test")
    public String test(){
        System.out.println("come int test..........");
        return "你好qcby 2022！";
    }

    @RequestMapping("test1")
    public String test(String name,String name1){
        System.out.println("come int test..........");
        return "你好  "+name+" 2022！";
    }
    /**
     *
     *
     * 记录记录：期望记录所有文章、资料、视频等等内容的浏览记录
     *      type: 文章、资料、视频
     *      id:  对应内容的 参数id
     *              文章： id
     *              资料：dataId
     *              视频：vId
     *
     *
     *
     *     内容类型 -   记录好对应类型 文章、视频、资料等等
     *     具体那个内容  -   数据ID
     *     那个用户  -     用户ID
     *
     *
     *
     */
    /**
     * 浏览
     * @param id
     * @return
     */
    @SelfRecords(recordsType = Constant.RECORD_TYPE_ARTICLE)
    @RequestMapping
    public ResultJson view(Long id){
        log.info("===============>id:{}",id);
        return ResultJson.ok(id);
    }

    public static void main(String[] args) {
        log.info("入参：name:{},sex:{}","lxt","1");
        ResultJson r = ResultJson.ok("xxxxx");
        log.info("出参：{}",r);
    }
    /**
     * 下载
     * @param id666
     * @return
     */
//    @SelfLog(module = "用户管理",type = Constant.ADD)
    @SelfRecords(recordsType = Constant.RECORD_TYPE_ARTICLE
            ,type = Constant.DOWN_TYPE,id = "id666")
    @RequestMapping("down")
    public ResultJson down(Long id666){
//        new String
        log.info("===============>id666:{}",id666);
        return ResultJson.ok(id666);
    }



//    @RequestMapping("down")
//    @SelfRecords(type = Constant.DOWN_TYPE,id = "id666")
//    public ResultJson downTest(Long id666){
//        log.info("===============>id666:{}",id666);
//        return ResultJson.ok(id666);
//    }

}
